"""教师类"""


class Teacher:
    """
    定义教师基类
    """
    user_name = None  # 姓名
    age = None  # 年龄
    collage = None  # 毕业院校
    course = None  # 教什么课
    school = None  # 在什么学校教书
    teach_age = 0  # 教龄

    def __init__(self) -> None:
        print("创建实例")
        super().__init__()

    def __del__(self):
        print("对象被销毁了")

    def set_attr(self, user_name="", age=0, collage="", course="", school="", teach_age=0):
        self.user_name = user_name
        self.age = age
        self.collage = collage
        self.course = course
        self.school = school
        self.teach_age = teach_age

    def format(self):
        teacher_desc = ""
        teacher_desc += "姓名：" + self.user_name
        teacher_desc += "\n年龄：" + str(self.age)
        teacher_desc += "\n毕业院校：" + self.collage
        teacher_desc += "\n教什么课：" + self.course
        teacher_desc += "\n从教学校：" + self.school
        teacher_desc += "\n教龄：" + str(self.teach_age)
        return teacher_desc

    def get_user_name(self):
        return self.user_name

